<?php


namespace app\api\controller;


use think\Request;
//use think\cache\driver\Redis as redisDriver;


//https://cosimo.qswh.net.cn/api/redis/setData
//http://cosmo.com/api/redis/setData
class Redis extends BaseApi {

    public function setData(){

        if(!$this->request->param('uid') || !$this->request->param('goodsid')){
            return json(['code'=>-1,'msg'=>'缺少参数']);
        }

        $id = $this->request->param('uid');
        $goodsid = $this->request->param('goodsid');
        $redisService = new \app\api\service\Redis();
        $result = $redisService->buying($id,$goodsid);
        return json($result);
    }

    //数量入库
    public function entrepot(){

        if(!$this->request->param('goodsid')){
            return json(['code'=>-1,'msg'=>'缺少参数']);
        }

        $goodsid = $this->request->param('goodsid');
        $redisService = new \app\api\service\Redis();
        $result = $redisService->inventory($goodsid);
        return json($result);
    }

    public function getData(){
        $id = $this->request->param('goodsid');
        $redisService = new \app\api\service\Redis();
        $redisService->getData($id);
    }

    public function getKeys(){
        $redisService = new \app\api\service\Redis();
        $redisService->getKeys();
    }





}